package cn.hx.controller.front.user;

import cn.hx.entity.ItemUser;
import cn.hx.entity.UserInfo;
import cn.hx.service.ItemUserService;
import cn.hx.service.UserReportService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.List;

@Controller
public class MyApplicationContorller {

    @Resource
    private UserReportService userReportService;

    @GetMapping("/user/myapplication")
    public String queryByUserId(HttpSession httpSession, ModelMap modelMap){

            UserInfo userInfo =(UserInfo)httpSession.getAttribute("userInfo");
            List<ItemUser> itemUsers=userReportService.queryByUserId(userInfo.getId());
            modelMap.put("items",itemUsers);

        return "user/myapplication";
    }

}
